--[[ 编码: JX-33-02 名称: 指定出库-创建后 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: AfterDataObjCreate 功能: -- 考虑到物料编码和容器编码允许输入,因此需要判断一下物料编码是否有效 更改记录: --]] wms_out = require( "wms_outbound" ) wms_station = require( "wms_station" ) function AfterDataObjCreate ( strLuaDEID ) local nRet, strRetInfo local specify_outbound nRet, specify_outbound = m3.GetCurEditDataObj( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..specify_outbound ) end local station = lua.Get_StrAttrValue( specify_outbound.station ) local to_loc_code = lua.Get_StrAttrValue( specify_outbound.to_loc_code ) if ( to_loc_code == '' ) then nRet, to_loc_code = wms_station.Get_Station_Loc( strLuaDEID, station ) if ( nRet ~= 0 ) then lua.Stop( strLuaDEID, to_loc_code ) return end end -- 1 指定货品出库 if ( specify_outbound.type == 2 ) then nRet, strRetInfo = wms_out.Create_SOO_ByMaterial( strLuaDEID, station, specify_outbound.so_no, specify_outbound.area_code, specify_outbound.item_code, to_loc_code, "指定出库", "巨沃" ) if ( nRet ~= 0 ) then mobox.stopProgram( strLuaDEID, "创建指定出库作业失败!"..strRetInfo ) return end else -- 指定容器出库 local cntr_code = specify_outbound.cntr_code -- 判断容器是否存在 if ( wms_cntr.Exist( strLuaDEID, cntr_code ) == false ) then mobox.stopProgram( strLuaDEID, "容器'"..cntr_code.."'不存在" ) return end -- 创建指定出库作业 nRet, strRetInfo = wms_out.Create_SOO_ByContainer( strLuaDEID, station, specify_outbound.so_no, cntr_code, to_loc_code, "指定出库", "巨沃" ) if ( nRet ~= 0 ) then mobox.stopProgram( strLuaDEID, "创建指定出库作业失败!"..strRetInfo ) return end end end